package com.aw.baselib.widgets.font;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;

import com.aw.baselib.R;
import com.aw.baselib.base.AwBaseApplication;

/**
 * @author : hzw
 * https://blog.csdn.net/yuanxw44/article/details/80019501
 */
@SuppressLint("AppCompatCustomView")
public class AwEtLight extends AwEtRegularBase {

    public AwEtLight(Context context, AttributeSet attrs) {
        super(context, attrs);
        setTypeface(AwBaseApplication.getInstance().getTypefaceLight());
    }

    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
    }

    @Override
    protected void setViewBg() {
        setBackground(getResources().getDrawable(R.drawable.bg_common_input_empty));
    }

    @Override
    protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
        super.onFocusChanged(focused, direction, previouslyFocusedRect);
        if(focused) {
            setBackground(getResources().getDrawable(R.drawable.bg_common_input_active));
        } else {
            setBackground(getResources().getDrawable(R.drawable.bg_common_input_normal));
        }
    }
}
